﻿using System.Collections.Generic;
using System.Web;
using CommonGenius.Collections;
using AspNetInfo.Core;
using System.Data;

namespace AspNetInfo.Detectors
{
    public class ApplicationVariablesDetector : IDetector
    {

        public DataTable Detect(EnvironmentPermissions permissions)
        {
            var context = HttpContext.Current;
            var dt = DetectorHelper.MakeResultTable();
            dt.Rows.Add("Variable Count", context.Application.Count.ToString());

            foreach (string key in context.Application.Keys)
            {
                dt.Rows.Add(key, context.Application[key].ToString());
            }
            return dt;
        }

        public string Name
        {
            get { return "Application Variables"; }
        }
        
        public string Description
        {
            get { return string.Empty; }
        }

        public string TabName
        {
            get { return Tabs.WebApp; }
        }
    }
}
